import { Controller, Get, Post, UploadedFile, UploadedFiles, UseInterceptors } from '@nestjs/common';
import { AppService } from './app.service';
import { FileInterceptor } from '@nestjs/platform-express';
import { extname } from 'path';
@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }

  @Post('upload')
  @UseInterceptors(FileInterceptor('file'))
  upload(@UploadedFile() file: Express.Multer.File): any {
    return file;
  }

  @Post('uploads')
  @UseInterceptors(FileInterceptor('file',{
    dest: 'uploads'
  }))
  uploads(@UploadedFiles() file: Express.Multer.File[]): any {
    console.log(file)
    return file;
  }
}
